function  img =  set_subpart_patch(orig, img, patch)
    siz     =   size(img);
    patchSiz      =   size(patch);
    orig    =   round(orig);
    left    =   max(orig(1), 1);    top    =   max(orig(2),1);
    right   =   min(orig(1)+patchSiz(2)-1, siz(2));
    bottom  =   min(orig(2)+patchSiz(1)-1, siz(1));
    
    left2   =   left - orig(1)+1;     top2  = top - orig(2)+1;
    right2  =   right - orig(1) +1;      bottom2 = bottom - orig(2) +1;
     
    img(top:bottom, left:right) =  patch(top2:bottom2, left2:right2);
  